<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/binaryArith.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">binaryArith.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="binary_arith_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_BINARYARITH_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_BINARYARITH_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_encrypted_array_8h.html">helib/EncryptedArray.h</a>&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_ct_ptrs_8h.html">helib/CtPtrs.h</a>&gt;</span> <span class="comment">//  defines CtPtrs, CtPtrMat</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;std::vector&lt;long&gt; <a class="code" href="namespacehelib.html#ab0f609e8138ce597457cbf6168d27363">longToBitVector</a>(<span class="keywordtype">long</span> num, <span class="keywordtype">long</span> bitSize);</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6cc8eab5085d47ef2587ff4253ec5d77">binaryCond</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output,</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;                <span class="keyword">const</span> Ctxt&amp; cond,</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; trueValue,</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; falseValue);</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aa08be8ce0b0f4ca1f870c56508889598">binaryMask</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; binaryNums, <span class="keyword">const</span> Ctxt&amp; mask);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ab31dff00b9bd2df3454c7dc7a7edf16b">concatBinaryNums</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; a, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; b);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a5442620f8d9b1e48c79e6d0c30eb9cec">splitBinaryNums</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; leftSplit,</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;                     <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rightSplit,</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                     <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#ac577a548455a706fa164247e3801e05a">leftBitwiseShift</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input, <span class="keyword">const</span> <span class="keywordtype">long</span> shamt);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a7a59ff05d1c4f1800bb2010e451576ab">bitwiseRotate</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input, <span class="keywordtype">long</span> rotamt);</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#abaa682a93edca39cb5ce5524219c486c">bitwiseXOR</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a2928d18450500f401e36d50a8288bf0e">bitwiseOr</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs);</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160; </div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6e4ba60fb6ef861f9601a3c22c589315">bitwiseAnd</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs);</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a6e4ba60fb6ef861f9601a3c22c589315">bitwiseAnd</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output,</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;                <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input,</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;                <span class="keyword">const</span> std::vector&lt;long&gt; mask);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3bc4da63675257eacdf323d32ca23a83">bitwiseNot</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; output, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input);</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a277237f0883421a2abee740db9f1b6ef">addTwoNumbers</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; sum,</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                   <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs,</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                   <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs,</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                   <span class="keywordtype">long</span> sizeLimit = 0,</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                   std::vector&lt;zzX&gt;* unpackSlotEncoding = <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aaff515cbc7e22db14c0b22c910f4cee2">negateBinary</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; negation, <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; input);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160; </div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a3828f8e07ee92999ebe6163fb96c5fd5">subtractBinary</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; difference,</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs,</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs,</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                    std::vector&lt;zzX&gt;* unpackSlotEncoding = <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;<span class="keywordtype">long</span> <a class="code" href="namespacehelib.html#a635ecc26ac755424a9f834d4eca7d68e">fifteenOrLess4Four</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; out,</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;                        <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; in,</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;                        <span class="keywordtype">long</span> sizeLimit = 4);</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a34e793367187e97095f9f2590eb4dc5e">addManyNumbers</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; sum,</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;                    <a class="code" href="namespacehelib.html#ac54132076174cf5388da4f1121f4d417">CtPtrMat</a>&amp; numbers,</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;                    <span class="keywordtype">long</span> sizeLimit = 0,</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;                    std::vector&lt;zzX&gt;* unpackSlotEncoding = <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160; </div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aa9936528f7b1f6865e4a496047caba21">multTwoNumbers</a>(<a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; product,</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; lhs,</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;                    <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; rhs,</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                    <span class="keywordtype">bool</span> rhsTwosComplement = <span class="keyword">false</span>,</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;                    <span class="keywordtype">long</span> sizeLimit = 0,</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                    std::vector&lt;zzX&gt;* unpackSlotEncoding = <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160; </div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a1285dad7ef04a62fde04003b87ee1110">decryptBinaryNums</a>(std::vector&lt;long&gt;&amp; pNums,</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;                       <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; eNums,</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;                       <span class="keyword">const</span> SecKey&amp; sKey,</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;                       <span class="keyword">const</span> EncryptedArray&amp; ea,</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;                       <span class="keywordtype">bool</span> twosComplement = <span class="keyword">false</span>,</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;                       <span class="keywordtype">bool</span> allSlots = <span class="keyword">true</span>);</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160; </div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#aea4d00f74735017eb674bc25cca0d47d">packedRecrypt</a>(<span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; a,</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;                   <span class="keyword">const</span> <a class="code" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a>&amp; b,</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;                   std::vector&lt;zzX&gt;* unpackSlotEncoding);</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160; </div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_BINARYARITH_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespacehelib_html_a277237f0883421a2abee740db9f1b6ef"><div class="ttname"><a href="namespacehelib.html#a277237f0883421a2abee740db9f1b6ef">helib::addTwoNumbers</a></div><div class="ttdeci">void addTwoNumbers(CtPtrs &amp;sum, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs, long sizeLimit=0, std::vector&lt; zzX &gt; *unpackSlotEncoding=nullptr)</div><div class="ttdoc">Adds two numbers in binary representation where each ciphertext of the input vector contains a bit.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:644</div></div>
<div class="ttc" id="a_ct_ptrs_8h_html"><div class="ttname"><a href="_ct_ptrs_8h.html">CtPtrs.h</a></div><div class="ttdoc">Unified interface for vector of pointers to ciphertexts.</div></div>
<div class="ttc" id="anamespacehelib_html_aa9936528f7b1f6865e4a496047caba21"><div class="ttname"><a href="namespacehelib.html#aa9936528f7b1f6865e4a496047caba21">helib::multTwoNumbers</a></div><div class="ttdeci">void multTwoNumbers(CtPtrs &amp;product, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs, bool rhsTwosComplement=false, long sizeLimit=0, std::vector&lt; zzX &gt; *unpackSlotEncoding=nullptr)</div><div class="ttdoc">Multiply two numbers in binary representation where each ciphertext of the input vector contains a bi...</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:1027</div></div>
<div class="ttc" id="anamespacehelib_html_a2928d18450500f401e36d50a8288bf0e"><div class="ttname"><a href="namespacehelib.html#a2928d18450500f401e36d50a8288bf0e">helib::bitwiseOr</a></div><div class="ttdeci">void bitwiseOr(CtPtrs &amp;output, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs)</div><div class="ttdoc">Compute a bitwise OR between lhs and rhs.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:594</div></div>
<div class="ttc" id="anamespacehelib_html_ac54132076174cf5388da4f1121f4d417"><div class="ttname"><a href="namespacehelib.html#ac54132076174cf5388da4f1121f4d417">helib::CtPtrMat</a></div><div class="ttdeci">PtrMatrix&lt; Ctxt &gt; CtPtrMat</div><div class="ttdef"><b>Definition:</b> CtPtrs.h:38</div></div>
<div class="ttc" id="anamespacehelib_html_a6cc8eab5085d47ef2587ff4253ec5d77"><div class="ttname"><a href="namespacehelib.html#a6cc8eab5085d47ef2587ff4253ec5d77">helib::binaryCond</a></div><div class="ttdeci">void binaryCond(CtPtrs &amp;output, const Ctxt &amp;cond, const CtPtrs &amp;trueValue, const CtPtrs &amp;falseValue)</div><div class="ttdoc">Implementation of output = cond * trueValue + (1 - cond) * falseValue.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:510</div></div>
<div class="ttc" id="anamespacehelib_html_a3828f8e07ee92999ebe6163fb96c5fd5"><div class="ttname"><a href="namespacehelib.html#a3828f8e07ee92999ebe6163fb96c5fd5">helib::subtractBinary</a></div><div class="ttdeci">void subtractBinary(CtPtrs &amp;difference, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs, std::vector&lt; zzX &gt; *unpackSlotEncoding=nullptr)</div><div class="ttdoc">Subtracts rhs from lhs where lhs, rhs are in 2's complement.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:700</div></div>
<div class="ttc" id="anamespacehelib_html_a7a59ff05d1c4f1800bb2010e451576ab"><div class="ttname"><a href="namespacehelib.html#a7a59ff05d1c4f1800bb2010e451576ab">helib::bitwiseRotate</a></div><div class="ttdeci">void bitwiseRotate(CtPtrs &amp;output, const CtPtrs &amp;input, long rotamt)</div><div class="ttdoc">Rotate input by rotamt.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:572</div></div>
<div class="ttc" id="anamespacehelib_html_aaff515cbc7e22db14c0b22c910f4cee2"><div class="ttname"><a href="namespacehelib.html#aaff515cbc7e22db14c0b22c910f4cee2">helib::negateBinary</a></div><div class="ttdeci">void negateBinary(CtPtrs &amp;negation, const CtPtrs &amp;input)</div><div class="ttdoc">Negates a number in binary 2's complement representation.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:680</div></div>
<div class="ttc" id="anamespacehelib_html_a5442620f8d9b1e48c79e6d0c30eb9cec"><div class="ttname"><a href="namespacehelib.html#a5442620f8d9b1e48c79e6d0c30eb9cec">helib::splitBinaryNums</a></div><div class="ttdeci">void splitBinaryNums(CtPtrs &amp;leftSplit, CtPtrs &amp;rightSplit, const CtPtrs &amp;input)</div><div class="ttdoc">Splits a single binary number into two binary numbers leftSplit and rightSplit.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:547</div></div>
<div class="ttc" id="a_encrypted_array_8h_html"><div class="ttname"><a href="_encrypted_array_8h.html">EncryptedArray.h</a></div><div class="ttdoc">Data-movement operations on encrypted arrays of slots.</div></div>
<div class="ttc" id="anamespacehelib_html_a1285dad7ef04a62fde04003b87ee1110"><div class="ttname"><a href="namespacehelib.html#a1285dad7ef04a62fde04003b87ee1110">helib::decryptBinaryNums</a></div><div class="ttdeci">void decryptBinaryNums(std::vector&lt; long &gt; &amp;pNums, const CtPtrs &amp;eNums, const SecKey &amp;sKey, const EncryptedArray &amp;ea, bool twosComplement=false, bool allSlots=true)</div><div class="ttdoc">Decrypt the binary numbers that are encrypted in eNums.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:1352</div></div>
<div class="ttc" id="anamespacehelib_html_a34e793367187e97095f9f2590eb4dc5e"><div class="ttname"><a href="namespacehelib.html#a34e793367187e97095f9f2590eb4dc5e">helib::addManyNumbers</a></div><div class="ttdeci">void addManyNumbers(CtPtrs &amp;sum, CtPtrMat &amp;numbers, long sizeLimit=0, std::vector&lt; zzX &gt; *unpackSlotEncoding=nullptr)</div><div class="ttdoc">Sum an arbitrary amount of numbers in binary representation.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:895</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="anamespacehelib_html_abaa682a93edca39cb5ce5524219c486c"><div class="ttname"><a href="namespacehelib.html#abaa682a93edca39cb5ce5524219c486c">helib::bitwiseXOR</a></div><div class="ttdeci">void bitwiseXOR(CtPtrs &amp;output, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs)</div><div class="ttdoc">Compute a bitwise XOR between lhs and rhs.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:584</div></div>
<div class="ttc" id="anamespacehelib_html_a6e4ba60fb6ef861f9601a3c22c589315"><div class="ttname"><a href="namespacehelib.html#a6e4ba60fb6ef861f9601a3c22c589315">helib::bitwiseAnd</a></div><div class="ttdeci">void bitwiseAnd(CtPtrs &amp;output, const CtPtrs &amp;lhs, const CtPtrs &amp;rhs)</div><div class="ttdoc">Compute a bitwise AND between lhs and rhs.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:609</div></div>
<div class="ttc" id="anamespacehelib_html_a635ecc26ac755424a9f834d4eca7d68e"><div class="ttname"><a href="namespacehelib.html#a635ecc26ac755424a9f834d4eca7d68e">helib::fifteenOrLess4Four</a></div><div class="ttdeci">long fifteenOrLess4Four(const CtPtrs &amp;out, const CtPtrs &amp;in, long sizeLimit=4)</div><div class="ttdoc">Add together up to fifteen {0,1} integers, producing a 4-bit counter.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:1316</div></div>
<div class="ttc" id="anamespacehelib_html_ab0f609e8138ce597457cbf6168d27363"><div class="ttname"><a href="namespacehelib.html#ab0f609e8138ce597457cbf6168d27363">helib::longToBitVector</a></div><div class="ttdeci">std::vector&lt; long &gt; longToBitVector(long num, long bitSize)</div><div class="ttdoc">Returns a number as a vector of bits with LSB on the left.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:493</div></div>
<div class="ttc" id="anamespacehelib_html_aa08be8ce0b0f4ca1f870c56508889598"><div class="ttname"><a href="namespacehelib.html#aa08be8ce0b0f4ca1f870c56508889598">helib::binaryMask</a></div><div class="ttdeci">void binaryMask(CtPtrs &amp;binaryNums, const Ctxt &amp;mask)</div><div class="ttdoc">Zeroes the slots of binaryNums where the corresponding slot of mask is 0.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:503</div></div>
<div class="ttc" id="anamespacehelib_html_afac4e5ae4b272f9ffd07daee26285dad"><div class="ttname"><a href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">helib::CtPtrs</a></div><div class="ttdeci">PtrVector&lt; Ctxt &gt; CtPtrs</div><div class="ttdef"><b>Definition:</b> CtPtrs.h:25</div></div>
<div class="ttc" id="anamespacehelib_html_ac577a548455a706fa164247e3801e05a"><div class="ttname"><a href="namespacehelib.html#ac577a548455a706fa164247e3801e05a">helib::leftBitwiseShift</a></div><div class="ttdeci">void leftBitwiseShift(CtPtrs &amp;output, const CtPtrs &amp;input, const long shamt)</div><div class="ttdoc">Left shift input by shamt.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:559</div></div>
<div class="ttc" id="anamespacehelib_html_ab31dff00b9bd2df3454c7dc7a7edf16b"><div class="ttname"><a href="namespacehelib.html#ab31dff00b9bd2df3454c7dc7a7edf16b">helib::concatBinaryNums</a></div><div class="ttdeci">void concatBinaryNums(CtPtrs &amp;output, const CtPtrs &amp;a, const CtPtrs &amp;b)</div><div class="ttdoc">Concatenates two binary numbers into a single CtPtrs object. E.g. If a=10111, b=00101 then output = 1...</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:535</div></div>
<div class="ttc" id="anamespacehelib_html_a3bc4da63675257eacdf323d32ca23a83"><div class="ttname"><a href="namespacehelib.html#a3bc4da63675257eacdf323d32ca23a83">helib::bitwiseNot</a></div><div class="ttdeci">void bitwiseNot(CtPtrs &amp;output, const CtPtrs &amp;input)</div><div class="ttdoc">Compute a bitwise NOT of input.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:633</div></div>
<div class="ttc" id="anamespacehelib_html_aea4d00f74735017eb674bc25cca0d47d"><div class="ttname"><a href="namespacehelib.html#aea4d00f74735017eb674bc25cca0d47d">helib::packedRecrypt</a></div><div class="ttdeci">void packedRecrypt(const CtPtrs &amp;a, const CtPtrs &amp;b, std::vector&lt; zzX &gt; *unpackSlotEncoding)</div><div class="ttdoc">Function for packed recryption to recrypt multiple numbers.</div><div class="ttdef"><b>Definition:</b> binaryArith.cpp:461</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
